<?php
namespace Popshouse\AdminBundle\Controller;

use Symfony\Bundle\FrameworkBundle\Controller\Controller;
use Symfony\Component\HttpFoundation\RedirectResponse;
use Symfony\Component\Security\Core\SecurityContext;

class IndexController extends Controller
{
	
	
    /**
     * @extra:Template()
     */
    public function indexAction()
    {
    	//die($this->get('twig'));
    	//$this->get('twig')->addExtension(new AsseticExtension(new AssetFactory(), false));
        return array('active'=>'home');
    }

    
    /**
     * @extra:Template()
     */
    public function loginAction()
    {
    	if ($this->get('request')->attributes->has(SecurityContext::AUTHENTICATION_ERROR)) {
            $error = $this->get('request')->attributes->get(SecurityContext::AUTHENTICATION_ERROR);
        } else {
            $error = $this->get('request')->getSession()->get(SecurityContext::AUTHENTICATION_ERROR);
        }

        return array(
            'last_username' => $this->get('request')->getSession()->get(SecurityContext::LAST_USERNAME),
            'error'         => $error,
        	'active'=>'home'
        );
    }

    public function securityCheckAction()
    {
        // The security layer will intercept this request
    }


    public function logoutAction()
    {
        // The security layer will intercept this request
    }

}
